import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import {ethers} from 'hardhat';
import { MonkeyKing } from '../src/types';
import {ContractReceipt,ContractTransaction} from "ethers";
import { Contract } from 'hardhat/internal/hardhat-network/stack-traces/model';

let  contract:MonkeyKing;
async function deployMonkeyKing() {
    let MonkeyKing_Factory = await ethers.getContractFactory("MonkeyKing");
    let operator :SignerWithAddress;

    [operator] =await  ethers.getSigners();
    contract = (await (MonkeyKing_Factory).connect(operator).deploy(10,"MonkeyKing","MKK")) as MonkeyKing;
    console.log("[DEPLOY] 部署合约成功:"+contract.address);

    let tx = await contract.newArrtibutesFactorys();

    tx as ContractTransaction;
    console.log("交易哈希:"+tx.hash,"\n交易数据:"+tx.data);

    await tx.wait(5).then((receipt) =>{
        console.log("创建工厂成功!!")
        console.log("gas:"+receipt.gasUsed);
        console.log("区块高度:"+receipt.blockNumber);
    });

}  

deployMonkeyKing();